//***************************************************************************
//*
//*	File:			dswl_genericdocument.h
//*	Description:	Wrapper for IGenericDocument interface
//*
//***************************************************************************
//*
//*	Note:			This source code is provided "as is" meaning that you may 
//*					use it at your own risk. 
//*					You are free to use it in any way you like.
//*
//***************************************************************************
//*
//*	History:		
//*
//*	-------------------------------------------------------------------------
//*	2003/07/27	|	Initial release									|	rk
//*	-------------------------------------------------------------------------
//*
//***************************************************************************

//
//-------------------------------------------------------------- PREPROCESSOR 
//

#ifndef			_DSWL_GENERICDOCUMENT_H_INCLUDED
#define			_DSWL_GENERICDOCUMENT_H_INCLUDED

#if				_MSC_VER > 1000
#pragma once
#ifdef			__SWITCH_SHOW_HEADER
#pragma message ("-- dswl_genericdocument.h\n")
#endif
#ifdef			__SWITCH_SHOW_HEADER_TREE
#pragma message ("-- "__FILE__"\n")
#endif
#endif 

#ifdef			_DSWL_SWITCH_USE_AUTOCAST
#ifdef			_DSWL_SWITCH_USE_UNSAFE_AUTOCAST
#pragma	message ( "-- dswl_genericdocument.h \t Warning: Generating auto-cast operator: CIGenericDocument::operator IGenericDocument* () const" )
#else
#pragma	message ( "-- dswl_genericdocument.h \t Warning: Generating auto-cast operator: CIGenericDocument::operator       IGenericDocument* ()" )
#pragma	message ( "-- dswl_genericdocument.h \t Warning: Generating auto-cast operator: CIGenericDocument::operator const IGenericDocument* () const" )
#endif
#endif

//
//-------------------------------------------------------------- DEPENDENCIES
//

//
//------------------------------------------------------ FORWARD DECLARATIONS
//

class			CIApplication	;
class			CIGenericWindow	;
class			CIWindows		;

//
//--------------------------------------------------------- CLASS DECLARATION
//

//***************************************************************************
//**	@DOC		CLASS CIGenericDocument
//***************************************************************************
//*		@CLASS		Wrapper for IGenericDocument interface
//***************************************************************************
class _DSWL_EXT_CLASS CIGenericDocument  
{
	//																								
	//-----------------------------------------------------------------------						
	//***************************     ATTRIBS     ***************************						
	//-----------------------------------------------------------------------						
	//																								
private:																											// @ACCESS	Private Attributes	
			CComPtr< IGenericDocument >	m_pIGenericDocument	;														// @CMEMBER	Smart pointer to the actual generic document interface
																									
	//																												
	//-----------------------------------------------------------------------										
	//*************************     PROPERTIES     **************************						
	//-----------------------------------------------------------------------										
	//																												
public:																												// @ACCESS	Public Property Methods
			CIApplication				GetApplication		( void )									const	;	// @CMEMBER	Determines the application this document belongs to
			CIGenericWindow				GetActiveWindow		( void )									const	;	// @CMEMBER	Determines the document's active window
			CIWindows					GetWindows			( void )									const	;	// @CMEMBER	Determines the windows displaying this document
																										
			CString						GetFullName			( void )									const	;	// @CMEMBER	Returns the document's full name
			CString						GetName				( void )									const	;	// @CMEMBER	Returns the document's name
			CString						GetPath				( void )									const	;	// @CMEMBER	Returns the document's path

			BOOL						IsActive			( void )									const	;	// @CMEMBER	Determines whether the document is active
			BOOL						IsSaved				( void )									const	;	// @CMEMBER	Determines whether the document is saved
			BOOL						IsReadOnly			( void )									const	;	// @CMEMBER	Determines whether the document is read-only

			void						SetActive			(		BOOL				a_bEnable	)	const	;	// @CMEMBER	Activates or deactivates the document
			void						SetReadOnly			(		BOOL				a_bEnable	)	const	;	// @CMEMBER	Sets or removes the read-only flag from the document

	//																												
	//-----------------------------------------------------------------------										
	//*************************     INFORMATION     *************************						
	//-----------------------------------------------------------------------										
	//																												
public:																												// @ACCESS	Public Information Methods
			BOOL						IsNull				( void )									const	;	// @CMEMBER	Determines whether the internal pointer is <t NULL>
			BOOL						IsValid				( void )									const	;	// @CMEMBER	Determines whether the internal pointer differs from <t NULL>
										
	//																											
	//-----------------------------------------------------------------------									
	//************************     MODIFICATION     *************************				
	//-----------------------------------------------------------------------									
	//																											
public:																												// @ACCESS	Public Modification Methods
			CIGenericWindow				NewWindow			( void )											;	// @CMEMBER	Opens a new window dispalying the document
			BOOL						PrintOut			( void )											;	// @CMEMBER	Prints the document

			DsSaveStatus				Save				( const	CString&			a_strFile			
															,		BOOL				a_bPrompt	)			;	// @CMEMBER	Saves the document
			DsSaveStatus				Close				(		BOOL				a_bSave		)			;	// @CMEMBER	Closes the document

			BOOL						Redo				( void )											;	// @CMEMBER	Re-does the latest undo
			BOOL						Undo				( void )											;	// @CMEMBER	Un-does the latest modification

	//																									
	//-----------------------------------------------------------------------							
	//**************************     OPERATORS     **************************							
	//-----------------------------------------------------------------------							
	//																									
public:																												// @ACCESS	Public Operators
			bool						operator	==		( const CIGenericDocument&	a_Other		)	const	;	// @CMEMBER	Comparison operator
			bool						operator	!=		( const CIGenericDocument&	a_Other		)	const	;	// @CMEMBER	Comparison operator
			bool						operator	<=		( const CIGenericDocument&	a_Other		)	const	;	// @CMEMBER	Comparison operator
			bool						operator	>=		( const CIGenericDocument&	a_Other		)	const	;	// @CMEMBER	Comparison operator
			bool						operator	<		( const CIGenericDocument&	a_Other		)	const	;	// @CMEMBER	Comparison operator
			bool						operator	>		( const CIGenericDocument&	a_Other		)	const	;	// @CMEMBER	Comparison operator
																									
			CIGenericDocument&			operator	=		(		IGenericDocument*	a_pIOther	)			;	// @CMEMBER	Copy operator
																								
			IGenericDocument*			operator	*		( void )											;	// @CMEMBER	Dereference operator
	const	IGenericDocument*			operator	*		( void )									const	;	// @CMEMBER	Dereference operator
																										
			IGenericDocument*			operator	->		( void )											;	// @CMEMBER	Member access operator
	const	IGenericDocument*			operator	->		( void )									const	;	// @CMEMBER	Member access operator

	#ifdef	_DSWL_SWITCH_USE_AUTOCAST
	#ifdef	_DSWL_SWITCH_USE_UNSAFE_AUTOCAST
										operator			IGenericDocument*	( void )				const	;	// @CMEMBER	TypeCast operator
	#else								
										operator			IGenericDocument*	( void )						;	// @CMEMBER	TypeCast operator
										operator	const	IGenericDocument*	( void )				const	;	// @CMEMBER	TypeCast operator
	#endif
	#endif

	//																						
	//-----------------------------------------------------------------------				
	//***********************     CON/DESTRUCTION     ***********************				
	//-----------------------------------------------------------------------				
	//																						
public:																												// @ACCESS	Public Con-/Destruction Methods	
			 CIGenericDocument( IGenericDocument* a_pIGenericDocument = NULL );										// @CMEMBER	Default constructor
	virtual ~CIGenericDocument();																					// @CMEMBER	Default destructor
};
//***************************************************************************
//**	@END
//***************************************************************************

#endif		// _DSWL_GENERICDOCUMENT_H_INCLUDED
